package com.warehouse.service.impl;

import com.warehouse.entity.PayType;
import com.warehouse.entity.ProType;
import com.warehouse.mapper.PayTypeExample;
import com.warehouse.mapper.PayTypeMapper;
import com.warehouse.service.PayTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @program: warehouse
 * @author: SuRui
 * @create: 2021-01-13 10:04
 * @Version: 1.0
 */
@Service
public class PayTypeServiceImpl implements PayTypeService {
    @Autowired
    private PayTypeMapper payTypeMapper;

    /**
     * 全查
     * @return
     */
    @Override
    public List<PayType> findAll() {

        return payTypeMapper.findAllPayType();
    }

    @Override
    public List<PayType> findPayTypeByName(String name) {
        return null;
    }

//    /**
//     * 根据类别名查询
//     * @param name
//     * @return
//     */
//    @Override
//    public List<PayType> findPayTypeByName(String name) {
//       return payTypeMapper.findPayTypeByName(name);
//    }


    /**
     * 添加
     * @param payType
     * @return
     */
    @Override
    public boolean insertPayType(PayType payType) {
        return payTypeMapper.addPayType(payType);

    }

    /**
     * 删除
     * @param id
     * @return
     */
    @Override
    public boolean delPayTypeById(String id) {
        return payTypeMapper.deletePayType(id);
    }

    /**
     * 修改
     * @param payType
     * @return
     */
    @Override
    public boolean updatePayType(PayType payType) {
        return payTypeMapper.updatePayType(payType);
    }

    @Override
    public List<PayType> findPageType(Integer currentPage, Integer pageSize) {
        PayTypeExample example = new PayTypeExample();
        example.setOffset((currentPage-1)*pageSize);
        example.setLimit(pageSize);
        return payTypeMapper.selectByExample(example);
    }


}
